package com.cuitrip.business.reminder.model;

import android.view.View;

import com.cuitrip.business.order.detail.OrderFormActivity;
import com.cuitrip.push.model.PushMessageModel;
import com.cuitrip.service.R;
import com.cuitrip.util.ResourceUtil;
import com.cuitrip.util.time.InputTime;
import com.cuitrip.util.time.OutputTime;
import com.cuitrip.util.time.TimeUtil;

/**
 * Created by ak on 15/11/5.
 */
public class OrderCancelViewHolder extends ReminderInfoViewHolder {







    @Override
    public void render(final PushMessageModel object) {
        serviceName.setText(object.getServiceName());
        title.setText(ResourceUtil.getString(R.string.book_popup_cancel));
        if (object.getUserType() == PushMessageModel.TRAVELLER){
            subTitle.setText(ResourceUtil.getString(R.string.book_popup_cancel_desc_ft));
        }else{
            subTitle.setText(ResourceUtil.getString(R.string.book_popup_cancel_desc_fi));
        }
        String timeFormat = TimeUtil.formatTime(
                InputTime.build(object.getServiceDate(), TimeUtil.getZeroZone()),
                OutputTime.getInstance(OutputTime.OutputType.Type_DAY, TimeUtil.getZeroZone()));
        dateText.setText(timeFormat);
        actionStatus.setText(ResourceUtil.getString(R.string.attention_icon));
        actionStatus.setTextColor(ResourceUtil.getColor(R.color.mango_ffbb00));
        firstAction.setText(ResourceUtil.getString(R.string.operation_view_detail));
        firstAction.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (mWeakHostActivity.get().isNeedChangeType()){
                    changeType("cuitrip://order?oid=" + object.getMessageId());
                }else{
                    OrderFormActivity.start(mWeakHostActivity.get(),object.getMessageId());
                }
            }
        });
        secondAction.setVisibility(View.GONE);
    }


}
